package org.apache.lorry.zookeeper.meeting;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class ZkConstant {
    public static final String ROOT_PATH = "/meeting";

    //临时节点
    public static final String SPEAKER_PATH = ROOT_PATH + "/speaker";

    public static final String GET_PARTICIPANT_NAME_PATH = ROOT_PATH + "/participator_name";

    public static final String ASSIGN_PATH = ROOT_PATH + "/assign";

    public static final String LISTENER_PATH = ROOT_PATH + "/listener";

    public static final String STATUS_PATH = ROOT_PATH + "/status";

    public static final String TASK_PATH = ROOT_PATH + "/task";


    public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
        CountDownLatch waitSuccess = new CountDownLatch(1);
        ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, watchedEvent -> {
            waitSuccess.countDown();
            System.out.println(watchedEvent);
        });
        waitSuccess.await(5000, TimeUnit.MICROSECONDS);
        zooKeeper.delete(SPEAKER_PATH, -1);
    }
}